<!DOCTYPE html>
<html>
<head>
    <title>E8NET</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <include file="./App/Admin/View/Include/css.html" />
    <link rel="stylesheet" href="__PUBLIC__/Admin/css/compiled/tables.css" type="text/css" media="screen" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
</head>
<body>
<include file="./App/Admin/View/Include/navbar.html" />
<include file="./App/Admin/View/Include/menu.html" />


<!-- main container -->
<div class="content">

    <div class="container-fluid">
        <div id="pad-wrapper">

            <!-- users table -->
            <div class="table-wrapper users-table section">

                <div class="row-fluid head">
                    <div class="span12 head-pancel">
                        二级学院/专业班级/学生管理
                    </div>
                </div>
                <div class="row-fluid filter-block">
                    <div class="pull-left">
                        <input class="search" type="text" placeholder="输入学号或姓名" id="searchInput"/>
                        <input  type="submit" value="搜索" id="searchSubmit"/>
                        <span id="msg" style="display: none; color:darkred">
                            <i class="icon-remove-sign"></i>
                            <small></small>
                        </span>
                    </div>
                    <div class="pull-right">
                        <a href="{:U('Student/add',array('id'=>$c_id))}" class="btn-flat white new-product add-user">+ 添加学员</a>
                        <a href="{:U('Student/import',array('id'=>$c_id))}" class="btn-flat white new-product add-user">+ 导入学员</a>

                    </div>
                </div>

                <div class="row-fluid">
                    <table class="table table-hover">
                        <thead>
                        <tr>
                            <th class="span1">序号</th>
                            <th class="span2">
                                <span class="line"></span>学号
                            </th>
                            <th class="span2">
                                <span class="line"></span>姓名
                            </th>
                            <th class="span2">
                                <span class="line"></span>学院
                            </th>
                            <th class="span2">
                                <span class="line"></span>专业
                            </th>
                            <th class="span2">
                                <span class="line"></span>班级
                            </th>

                            <th class="span2 align-right">
                                <span class="line"></span>操作
                            </th>

                        </tr>
                        </thead>
                        <tbody id="studentList">
                        <foreach name= "studentList" item = "student" >
                            <tr>
                                <td>{$key+1}</td>
                                <td>{$student.num}</td>
                                <td>{$student.name}</td>
                                <td>{$student.d_name}</td>
                                <td>{$student.p_name}</td>
                                <td>{$student.c_name}</td>
                                <td class="align-right">
                                    <a href="{:U('Student/edit',array('id'=>$student['id']))}">修改</a>&nbsp;
                                    <a href="javascript:void(0);" onclick="return delConfirm('__APP__/Student/del/id/{$student.id}','对应记录被删除')">删除</a>
                                </td>
                            </tr>
                        </foreach>
                        </tbody>
                    </table>
                </div>
            </div>
            <!-- end users table -->

            <div class="row ctrls">
                <div class="pagination pull-right">
                    <ul>
                        {$page}
                    </ul>
                </div>
            </div>

        </div>
    </div>
</div>
<!-- end main container -->

<include file="./App/Admin/View/Include/js.html" />
<script>
    (function ($) {
        var msg = $('#msg');
        var msgSmall = $('#msg >small');
        var studentList = $('#studentList');
        var $searchInput = null;
        $(function () {

            $searchInput = $("#searchInput");
            $searchInput.keypress(function (e) {
                if(13==e.keyCode){
                    search();
                }
            });
            $('#searchSubmit').click(search);
        });
        function search() {
            $.post("{:U('Student/search')}", {
                "data":$searchInput.val()
            }, function (result) {

                if(result.status == 0){

                    msgSmall.html(result.errMsg);
                    msg.show();
                    setTimeout(function () {
                        msg.hide();
                    },3000);
                }else{
                    studentList.empty();
                    result.data.forEach(function(item,i){

                        studentList.append(
                                "<tr><td>"+(i+1)+"</td><td>"+item.num+"</td><td>"+item.name+"</td><td>"+item.xy[2]+"</td><td>"+item.xy[1]+"</td><td>"+item.xy[0]+"</td><td class='align-right'> <a href='/admin.php/Student/edit/id/"+item.id + ".htm'>修改</a>&nbsp; <a href='javascript:void(0);' onclick=\"return delConfirm('/admin.php/Student/del/id/"+item.id+"','对应记录被删除')\">删除</a> </td></tr>"
                        );
                    });

                }
            },"json");
        }
    })(jQuery);
</script>

</body>
</html>